"""
    @Author  ：思念 
    @File    ：6.aiomysql的简单使用.py
    @Date    ：2024/12/28 20:05 
"""

import aiomysql
import asyncio

async def get_db_info():
    async with aiomysql.connect(host='127.0.0.1', port=3306, user='root', password='root', db='py_spider') as db:
        async with db.cursor() as cursor:
            await cursor.execute('select * from tx_work')
            result = await cursor.fetchall()
            print(result)


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(get_db_info())